﻿using AutoMapper;
using YDT_OrderService.Applications.DTOs;
using YDT_OrderService.Domains.Entities;

namespace YDT_OrderService.Applications.Mappings
{
    public class MappingProfile : Profile
    {
        public MappingProfile()
        {
            CreateMap<Order, OrderDto>()
                .ForMember(dest => dest.OrderStatus,
                           opt => opt.MapFrom(src => src.OrderStatus.ToString()));

            CreateMap<OrderItem, OrderItemDto>();
            CreateMap<CreateOrderDto, Order>();
            CreateMap<CreateOrderItemDto, OrderItem>();
            CreateMap<UpdateOrderDto, Order>();
        }
    }
}
